Repository navigation
feat!: options and progress for cookbook transfers, and consistent option names - #152
Merged
Merged
Conversation
…tion names Cookbooks.Download, DownloadFiles and CookbookArtifacts.Upload took no options, and adding a variadic parameter after 1.0 would break method values and interface satisfaction. They now take options, starting with progress reporting a CLI needs for a large cookbook: - WithUploadProgress (Cookbooks.Upload, CookbookArtifacts.Upload) reports each file as it is uploaded; files the server already holds are not sent and not reported. - WithDownloadProgress (Download, DownloadFiles) reports each file once it is in place, fetched or already present, so the reports add up to the manifest. CookbookArtifacts.Upload refuses WithFreeze and WithForce: an artifact's identifier is a content hash and the server never replaces one. UploadOption is CookbookUploadOption, beside the new CookbookDownloadOption, since Client.Upload and CookbookArtifacts.Upload are uploads too. SkipChefignore is WithSkipChefignore, like every other option constructor. OrgUser.PublicKey is removed: erchef fills it only at API version 0 (chef_user.erl), and the client speaks 1. BREAKING CHANGE: UploadOption is CookbookUploadOption, SkipChefignore is WithSkipChefignore, OrgUser.PublicKey is removed, and Download, DownloadFiles and CookbookArtifacts.Upload take variadic options. Signed-off-by: Tim Smith <tsmith84@proton.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cookbooks.Download,DownloadFilesandCookbookArtifacts.Uploadtook no options. Adding a variadic parameter after 1.0 would break method values and interface satisfaction, so they get one now. The first options are progress reporting, which a CLI needs for a large cookbook:WithUploadProgress(fn)forCookbooks.UploadandCookbookArtifacts.Upload. It reports each file as it is uploaded. Files the server already holds are neither sent nor reported.WithDownloadProgress(fn)forDownloadandDownloadFiles. It reports each file once it is in place, whether fetched or already present, so the reports add up to the manifest.Transfers run in parallel, so
fnmay be called concurrently. This is documented.CookbookArtifacts.UploadrefusesWithFreezeandWithForce, because an artifact's identifier is a content hash and the server never replaces one.Consistent names:
UploadOption→CookbookUploadOption, next to the newCookbookDownloadOption.Client.UploadandCookbookArtifacts.Uploadare uploads too, so the bare name was ambiguous.SkipChefignore→WithSkipChefignore, like every other option constructor.OrgUser.PublicKeyis removed. erchef only fills it at API version 0 (chef_user.erl), and the client speaks 1.Breaking: the two renames, the removed field, and the new variadic parameters. The parameters break only code that stores the methods as values.
Test plan
go test ./... -race -count=2; new code at 100% coveragecd integration && go test ./..., golangci-lint in both modules